<?php get_header();?>
    <div id="post-22457-frame" class="single-content">
        <div id="post-22457" class="post-22457 post type-post status-publish format-standard has-post-thumbnail hentry category-fd tag-h5 tag-539 tag-543">
            <div class="detail-hd"> <img class="holder" src="https://isux.tencent.com/wp-content/themes/isux_v5/images/holder-192x58.png">
                <div class="tablelike">
            <?php  while (have_posts()) : the_post();
                /* 定义meta分区*/
                $meta_data = get_post_meta( get_the_ID(), 'article_options', true );
                /* meta数据获取*/
                $image_header = $meta_data['image_header'];
                $author_img = $meta_data['author_img'];
                $subtitle = $meta_data['subtitle'];
                $author_name = $meta_data['author_name'];
                $list_img = $meta_data['list_img'];

                /* meta图片url获取*/
                $author_img_url = wp_get_attachment_image_src( $author_img, 'full' );
                $image_header_url = wp_get_attachment_image_src( $image_header, 'full' );
                $list_img_url = wp_get_attachment_image_src( $list_img, 'full' );
            ?>
                    <div class="bg blur" style="background-image:url(<?php echo $image_header_url[0];?>)">
                        <div class="hover"></div>
                    </div>
                    
                        <div class="title-info">
                            <div class="wrap">
                                <h1 class="title"><?php the_title();?></h1>
                                <div class="author-name">
                                    <?php echo $author_name;?>
                                </div>
                            </div>
                        </div>
                        
                </div>
            </div>

                <div class="artical-content">

                    <?php the_content();?>
                        <div class="author-info author-page">
                            <div class="avatar-wrap"> <img src="<?php echo $author_img_url[0];?>" width="25" height="25" alt="<?php echo $author_name;?>" class="avatar avatar-25 wp-user-avatar wp-user-avatar-25 alignnone photo">
                               
                            </div>
                            <div class="author-name">
                                <?php echo $author_name;?>
                            </div>
                            <div class="post-date">
                                <?php the_time('Y-m-d');?>
                            </div>
                            <div class="single-functionbar">
                                <div class="post-nav page-btn-wrap">
                                    <?php
	                                   $prev_post = get_previous_post();
	                                   if(!empty($prev_post)):?>
                                    <div class="post-prev page-prev"><a href="<?php echo get_permalink($prev_post->ID);?>" rel="prev">上一篇</a>
                                        <div class="loading-cover" style="display: none;">上一篇</div>
                                    </div>
                                    <?php endif;?>
                                    <?php
	                                   $next_post = get_next_post();
	                                if(!empty($next_post)):?>
                                    <div class="post-next page-next"><a href="<?php echo get_permalink($next_post->ID);?>" rel="next">下一篇</a>
                                        <div class="loading-cover" style="display: none;">下一篇</div>
                                    </div>
                                    <?php endif;?>
                                </div>
                            
                                    <div class="bdsharebuttonbox">
                                        <a href="#" class="bds_more" data-cmd="more"></a>
                                        <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
                                        <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
                                        <a href="#" class="bds_copy" data-cmd="copy" title="分享到复制网址"></a>
                                        <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
                                    </div>
                                    <script>
                                        window._bd_share_config = {
                                            "common": {
                                                "bdSnsKey": {}
                                                , "bdText": ""
                                                , "bdMini": "1"
                                                , "bdMiniList": false
                                                , "bdPic": ""
                                                , "bdStyle": "2"
                                                , "bdSize": "24"
                                            }
                                            , "share": {}
                                        };
                                        with(document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];
                                    </script>
                            </div>
                            <div class="clear"></div>
                        </div>
                        <div class="clear"></div>
                </div>
                
                <!-- 相关文章推荐 -->
                <div class="related-post">
                    <h3>相关推荐</h3>
                    <ul class="related-img">
                    <?php
                        $post_num = 3;
                        $exclude_id = $post->ID;
                        $posttags = get_the_tags(); $i = 0;
                        if ( $posttags ) {
	                    $tags = ''; foreach ( $posttags as $tag ) $tags .= $tag->term_id . ',';
	                    $args = array(
	                    'post_status' => 'publish',
	                    'tag__in' => explode(',', $tags),
	                    'post__not_in' => explode(',', $exclude_id),
	                    'caller_get_posts' => 1,
                        'orderby' => 'comment_date',
                        'posts_per_page' => $post_num
                        );
	                    query_posts($args);
                        while( have_posts() ) { the_post(); 
                        /* 定义meta分区*/
                        $meta_data = get_post_meta( get_the_ID(), 'article_options', true );
                        /* meta数据获取*/
                        $image_header = $meta_data['image_header'];
                        $author_img = $meta_data['author_img'];
                        $subtitle = $meta_data['subtitle'];
                        $author_name = $meta_data['author_name'];
                        $list_img = $meta_data['list_img'];
                        /* meta图片url获取*/
                        $author_img_url = wp_get_attachment_image_src( $author_img, 'full' );
                        $image_header_url = wp_get_attachment_image_src( $image_header, 'full' );
                        $list_img_url = wp_get_attachment_image_src( $list_img, 'full' );
                    ?>
                        <li class="related-box"  >
                            <div class="r-pic">
                                <span>
                                    <img width="600" height="300" src="<?php echo $list_img_url[0];?>" class="attachment-box-image size-box-image wp-post-image" alt="banner" />                                
                                </span>
                            </div>
                            <a class="r-title" href="<?php the_content();?>" title="<?php the_title();?>" target="_blank" rel="bookmark">
                                <strong class="r-title-details"><?php the_title();?></strong>
                            </a>
                        </li>
                        
                    <?php
	                    $exclude_id .= ',' . $post->ID; $i ++;
                        } wp_reset_query();
                                                }
                        if ( $i < $post_num ) {
	                    $cats = ''; foreach ( get_the_category() as $cat ) $cats .= $cat->cat_ID . ',';
	                    $args = array(
	                    'category__in' => explode(',', $cats),
		                'post__not_in' => explode(',', $exclude_id),
		                'caller_get_posts' => 1,
	                    'orderby' => 'comment_date',
	                    'posts_per_page' => $post_num - $i
                        );
	                    query_posts($args);
                        while( have_posts() ) { the_post(); 
                        /* 定义meta分区*/
                        $meta_data = get_post_meta( get_the_ID(), 'article_options', true );
                        /* meta数据获取*/
                        $image_header = $meta_data['image_header'];
                        $author_img = $meta_data['author_img'];
                        $subtitle = $meta_data['subtitle'];
                        $author_name = $meta_data['author_name'];
                        $list_img = $meta_data['list_img'];
                        /* meta图片url获取*/
                        $author_img_url = wp_get_attachment_image_src( $author_img, 'full' );
                        $image_header_url = wp_get_attachment_image_src( $image_header, 'full' );
                        $list_img_url = wp_get_attachment_image_src( $list_img, 'full' );
                    ?>
                        <li class="related-box"  >
                            <div class="r-pic">
                                <span>
                                    <img width="600" height="300" src="<?php echo $list_img_url[0];?>" class="attachment-box-image size-box-image wp-post-image" alt="banner" />                                
                                </span>
                            </div>
                            <a class="r-title" href="<?php the_permalink();?>" title="<?php the_title();?>" target="_blank" rel="bookmark">
                                <strong class="r-title-details"><?php the_title();?></strong>
                            </a>
                        </li>
                        
                        <?php $i++;
	    } wp_reset_query();
        }
        if ( $i  == 0 )  echo '<div class="r_title">暂时没有相关文章!</div>';
        ?>
                    </ul>
                </div>  
                <!-- 相关文章推荐end -->
        </div>
    </div>
  <?php endwhile;?>
            <?php get_footer();?>